package day1.zy5;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class MapTest {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        Map<String,String> a=new HashMap<>();
        a.put("Dog","狗");
        a.put("Cat","猫");
        System.out.println("请输入单词");
        String s = in.next();
        if(a.containsKey(s)){
            System.out.println(a.get(s));
        }else {
            System.out.println("查无此字");
        }
        System.out.println("请输入汉字");
        String s1 = in.next();
        boolean b=false;
        for (Object o:a.keySet()){
            if (!a.get(o).equals(s1)){
                continue;
            }else {
                System.out.println(o);
                b=true;
            }
        }
        if (!b){
            System.out.println("查无此字");
        }
    }
}
